package cn.iocoder.yudao.module.exam.dal.mysql.knowledgegraph;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.exam.dal.dataobject.knowledgegraph.KnowledgeGraphDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.exam.controller.admin.knowledgegraph.vo.*;

/**
 * 知识图谱 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface KnowledgeGraphMapper extends BaseMapperX<KnowledgeGraphDO> {

    default PageResult<KnowledgeGraphDO> selectPage(KnowledgeGraphPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<KnowledgeGraphDO>()
                .eqIfPresent(KnowledgeGraphDO::getCode, reqVO.getCode())
                .eqIfPresent(KnowledgeGraphDO::getSubject, reqVO.getSubject())
                .eqIfPresent(KnowledgeGraphDO::getParentId, reqVO.getParentId())
                .eqIfPresent(KnowledgeGraphDO::getLevel, reqVO.getLevel())
                .eqIfPresent(KnowledgeGraphDO::getSortOrder, reqVO.getSortOrder())
                .eqIfPresent(KnowledgeGraphDO::getNodeType, reqVO.getNodeType())
                .eqIfPresent(KnowledgeGraphDO::getTitle, reqVO.getTitle())
                .eqIfPresent(KnowledgeGraphDO::getContent, reqVO.getContent())
                .eqIfPresent(KnowledgeGraphDO::getStyle, reqVO.getStyle())
                .eqIfPresent(KnowledgeGraphDO::getMetadata, reqVO.getMetadata())
                .betweenIfPresent(KnowledgeGraphDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(KnowledgeGraphDO::getId));
    }

}